package com.yc.multiple.dao.order;

import com.yc.multiple.bean.order.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class OrderDao {

    @Autowired()
    @Qualifier("orderJdbcTemplate")
    private JdbcTemplate jdbcTemplate;

    public List<Order> selectAll(){
        String sql="select order_id as orderId,order_name as orderName from order_test";
        return jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(Order.class));
    }
}
